package io.github.tangwan.designpattern.creational.singleton;

/**
 * @author tangwan
 * @version V1.0
 * created on 2021/9/27 11:17
 * @since JDK 1.8
 */
public class SingletonPatternDemo {

    public static void main(String[] args) {
        //不合法的构造函数
        //编译时错误：构造函数 SingleObject() 是不可见的
        //SingleObject object = new SingleObject();

        //获取唯一可用的对象
        Singleton3 object = Singleton3.getInstance();

        //显示消息
        object.showMessage();

        Singleton6.INSTANCE.whateverMethod();
    }

}
